(defun odometer	(/ entity ent-data probeg start-angle end-angle)
  (setq probeg 0.0)
  (setq entity (entnext))
  (while entity
    (setq ent-data (entget entity))
    (cond
      (
       (and (= (cdr (assoc 0 ent-data)) "LINE")
	    (/= (cdr (assoc 8 ent-data)) "PATH")
					; only if real "work" momement
       )
       (setq probeg (+ probeg
		       (distance (cdr (assoc 10 ent-data))
				 (cdr (assoc 11 ent-data))
		       )
		    )
       )
      )
      (
       (= (cdr (assoc 0 ent-data)) "CIRCLE")
       (setq probeg (+ probeg
		       (* 2.0 pi (cdr (assoc 40 ent-data)))
		    )
       )
      )
      (
       (= (cdr (assoc 0 ent-data)) "ARC")
       (setq probeg
	      (+ probeg
		 (* (cdr (assoc 40 ent-data))
		    (- (if (< (setq end-angle (cdr (assoc 51 ent-data)))
			      (setq start-angle (cdr (assoc 50 ent-data)))
			   )
			 (+ (* 2. pi) end-angle)
			 end-angle
		       )
		       start-angle
		    )
		 )
	      )
       )
      )
      (t nil)
    )
    (setq entity (entnext entity))
  )
  (strcat "S=" (itoa (fix probeg)) " mm")
)					; ODOMETER

